function animate(obj, target, callback) {

    clearInterval(obj.timer)

    obj.timer = setInterval(function () {
        var curr = obj.offsetLeft
        if (curr == target) {
            clearInterval(obj.timer)
            if (callback instanceof Function){
                callback()
            }
        } else {
            var step = (target - curr) / 10
            step = step > 0 ? Math.ceil(step) : Math.floor(step)
            obj.style.left = curr + step + 'px'
        }
    }, 15)
}